package com.litchi.tutor.controller;

import com.litchi.tutor.common.annotation.RequestBodyParam;
import com.litchi.tutor.common.entity.User;
import com.litchi.tutor.config.Properties;
import com.litchi.tutor.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author hoby
 * @since 2021-10-22
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    Properties properties;

    @Autowired
    UserService userService;

    @GetMapping("/hello")
    public String hello(@RequestBodyParam(required = false) String id, @RequestBodyParam(required = false) String name, @RequestBodyParam(required = false) String age) {
        System.out.println(id);
        System.out.println(name);
        System.out.println(age);
        return "hello";
    }

    @GetMapping("/hello1")
    public String hello(@RequestBody User user) {
        System.out.println(user);
        return "hello";
    }

    @PostMapping("/hello2")
    public String hello(@RequestParam String age) {
        System.out.println(age);
        return "hello";
    }
}
